package com.yzd.otherlearn.jvm;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
 * -Xms100M -Xmx100M -XX:+UseSerialGC
 * @author 10069212
 *
 */
public class JConsoleTest1 {
	static class OOMObject{
		public byte[] placeholder = new byte[64 * 1024];
	}
	
	public static void fillHeap(int num) throws InterruptedException {
		List<OOMObject> list = new ArrayList<>();
		for(int i = 0; i < num; i++) {
			TimeUnit.MILLISECONDS.sleep(70);
			list.add(new OOMObject());
		}
//		System.gc();
	}
	
	public static void main(String[] args) throws InterruptedException {
		fillHeap(1000);
		System.gc();
	}
}
